/**
 *  chenjie
 *  2012-5-8
 *  
 */

package com.pl.view.ad
{
	import com.pl.model.Data;
	
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.text.TextFormat;
	
	public class ADTimeSprite extends Sprite
	{
		private var text:TextField=new TextField()
		public function ADTimeSprite()
		{
			super();
			addChild(text)
			text.mouseEnabled=false
			text.defaultTextFormat=new TextFormat("",14,0xffffff,2)
			text.text="广告时间还剩 " +Data.adTotalTime+ " 秒"
			text.width=150
		}
		
		
		public function setTime(time:int):void{
			if(time != 0){
				allADTime=time
				text.text="广告时间还剩 " +time+ " 秒"
			}else{
				allADTime--
					text.text="广告时间还剩 " +allADTime+ " 秒"
				if(allADTime==0){
					dispatchEvent(new PlayerEvent(PlayerEvent.PLAY_CONTENT))
				}
			}
		}
		
	}
}